.Dd January 19, 2014
.Dt libvhdi 3
.Os libvhdi
.Sh NAME
.Nm libvhdi.h
.Nd Library to access the Virtual Hard Disk (VHD) image format
.Sh LIBRARY
.Lb libvhdi
.Sh SYNOPSIS
.In libvhdi.h
.Pp
Support functions
.Ft const char *
.Fn libvhdi_get_version "void"
.Ft int
.Fn libvhdi_get_access_flags_read "void"
.Ft int
.Fn libvhdi_get_access_flags_read_write "void"
.Ft int
.Fn libvhdi_get_access_flags_write "void"
.Ft int
.Fn libvhdi_get_codepage "int *codepage, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_set_codepage "int codepage, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_check_file_signature "const char *filename, libvhdi_error_t **error"
.Pp
Available when compiled with wide character string support:
.Ft int
.Fn libvhdi_check_file_signature_wide "const wchar_t *filename, libvhdi_error_t **error"
.Pp
Available when compiled with libbfio support:
.Ft int
.Fn libvhdi_check_file_signature_file_io_handle "libbfio_handle_t *file_io_handle, libvhdi_error_t **error"
.Pp
Notify functions
.Ft void
.Fn libvhdi_notify_set_verbose "int verbose"
.Ft int
.Fn libvhdi_notify_set_stream "FILE *stream, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_notify_stream_open "const char *filename, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_notify_stream_close "libvhdi_error_t **error"
.Pp
Error functions
.Ft void 
.Fn libvhdi_error_free "libvhdi_error_t **error"
.Ft int
.Fn libvhdi_error_fprint "libvhdi_error_t *error, FILE *stream"
.Ft int
.Fn libvhdi_error_sprint "libvhdi_error_t *error, char *string, size_t size"
.Ft int 
.Fn libvhdi_error_backtrace_fprint "libvhdi_error_t *error, FILE *stream"
.Ft int
.Fn libvhdi_error_backtrace_sprint "libvhdi_error_t *error, char *string, size_t size"
.Pp
File functions
.Ft int
.Fn libvhdi_file_initialize "libvhdi_file_t **file, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_free "libvhdi_file_t **file, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_signal_abort "libvhdi_file_t *file, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_open "libvhdi_file_t *file, const char *filename, int access_flags, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_close "libvhdi_file_t *file, libvhdi_error_t **error"
.Ft ssize_t
.Fn libvhdi_file_read_buffer "libvhdi_file_t *file, void *buffer, size_t buffer_size, libvhdi_error_t **error"
.Ft ssize_t
.Fn libvhdi_file_read_random "libvhdi_file_t *file, void *buffer, size_t buffer_size, off64_t offset, libvhdi_error_t **error"
.Ft off64_t
.Fn libvhdi_file_seek_offset "libvhdi_file_t *file, off64_t offset, int whence, libvhdi_error_t **error"
.Ft off64_t
.Fn libvhdi_file_get_offset "libvhdi_file_t *file, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_set_parent_file "libvhdi_file_t *file, libvhdi_file_t *parent_file, libcerror_error_t **error"
.Pp
Available when compiled with wide character string support:
.Ft int
.Fn libvhdi_file_open_wide "libvhdi_file_t *file, const wchar_t *filename, int access_flags, libvhdi_error_t **error"
.Pp
Available when compiled with libbfio support:
.Ft int
.Fn libvhdi_file_open_file_io_handle "libvhdi_file_t *file, libbfio_handle_t *file_io_handle, int access_flags, libvhdi_error_t **error"
.Pp
Meta data functions
.Ft int
.Fn libvhdi_file_get_format_version "libvhdi_file_t *file, uint16_t *major_version, uint16_t *minor_version, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_disk_type "libvhdi_file_t *file, uint32_t *disk_type, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_media_size "libvhdi_file_t *file, size64_t *media_size, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_identifier "libvhdi_file_t *file, uint8_t *guid, size_t size, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_parent_identifier "libvhdi_file_t *file, uint8_t *guid, size_t size, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_utf8_parent_filename_size "libvhdi_file_t *file, size_t *utf8_string_size, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_utf8_parent_filename "libvhdi_file_t *file, uint8_t *utf8_string, size_t utf8_string_size, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_utf16_parent_filename_size "libvhdi_file_t *file, size_t *utf16_string_size, libvhdi_error_t **error"
.Ft int
.Fn libvhdi_file_get_utf16_parent_filename "libvhdi_file_t *file, uint16_t *utf16_string, size_t utf16_string_size, libvhdi_error_t **error"
.Sh DESCRIPTION
The
.Fn libvhdi_get_version
function is used to retrieve the library version.
.Sh RETURN VALUES
Most of the functions return NULL or -1 on error, dependent on the return type. For the actual return values refer to libvhdi.h
.Sh ENVIRONMENT
None
.Sh FILES
None
.Sh NOTES
libvhdi uses mainly UTF-8 encoded strings except for filenames, but provides several UTF-16 functions.

ASCII strings in a EDB file contain an extended ASCII string using the codepage of the system it was created on. The function
.Ar libvhdi_set_ascii_codepage
 allows to set the required codepage for reading and writing. The default codepage is ASCII and replaces all extended characters to the Unicode replacement character (U+fffd) when reading and the ASCII substitude character (0x1a) when writing.

libvhdi allows to be compiled with wide character support.
To compile libvhdi with wide character support use
.Ar ./configure --enable-wide-character-type=yes
or pass the definition
.Ar HAVE_WIDE_CHARACTER_TYPE
 to the compiler (i.e. in case of Microsoft Visual Studio (MSVS) C++).

To have other code to determine if libvhdi was compiled with wide character support it defines
.Ar LIBVHDI_HAVE_WIDE_CHARACTER_TYPE
 in libvhdi/features.h.

libvhdi allows to be compiled with chained IO support using libbfio.
libvhdi will automatically detect if a compatible version of libbfio is available.

To have other code to determine if libvhdi was compiled with libbfio support it defines
.Ar LIBVHDI_HAVE_BFIO
 in libvhdi/features.h.

.Sh BUGS
Please report bugs of any kind to <joachim.metz@gmail.com> or on the project website:
http://code.google.com/p/libvhdi/
.Sh AUTHOR
These man pages were written by Joachim Metz.
.Sh COPYRIGHT
Copyright 2012-2014, Joachim Metz <joachim.metz@gmail.com>.
.Sh SEE ALSO
the libvhdi.h include file
